Skip to content

Conversation

@mtsokol
Copy link
Contributor

@mtsokol mtsokol commented Oct 15, 2024

Hi!
While working with MLIR standalone example it took me some time to figure out how to access dialects and execution engine from MLIR Python package.

I think it might be useful to include them in the standalone build already. WDYT?

@llvmbot llvmbot added the mlir label Oct 15, 2024
@llvmbot
Copy link
Member

llvmbot commented Oct 15, 2024

@llvm/pr-subscribers-mlir

Author: Mateusz Sokół (mtsokol)

Changes

Hi!
While working with MLIR standalone example it took me some time to figure out how to access dialects and execution engine from MLIR Python package.

I think it might be useful to include them in the standalone build already. WDYT?


Full diff: https://github.com/llvm/llvm-project/pull/112448.diff

2 Files Affected:

  • (modified) mlir/examples/standalone/python/CMakeLists.txt (+2)
  • (modified) mlir/examples/standalone/test/python/smoketest.py (+7-1)
diff --git a/mlir/examples/standalone/python/CMakeLists.txt b/mlir/examples/standalone/python/CMakeLists.txt
index a8c43827a5a375..b948f4d524e0b5 100644
--- a/mlir/examples/standalone/python/CMakeLists.txt
+++ b/mlir/examples/standalone/python/CMakeLists.txt
@@ -43,7 +43,9 @@ add_mlir_python_common_capi_library(StandalonePythonCAPI
     # TODO: Remove this in favor of showing fine grained registration once
     # available.
     MLIRPythonExtension.RegisterEverything
+    MLIRPythonExtension.ExecutionEngine
     MLIRPythonSources.Core
+    MLIRPythonSources.Dialects
 )
 
 ################################################################################
diff --git a/mlir/examples/standalone/test/python/smoketest.py b/mlir/examples/standalone/test/python/smoketest.py
index 08e08cbd2fe24c..3ea4283f8f41c2 100644
--- a/mlir/examples/standalone/test/python/smoketest.py
+++ b/mlir/examples/standalone/test/python/smoketest.py
@@ -1,7 +1,13 @@
 # RUN: %python %s | FileCheck %s
 
 from mlir_standalone.ir import *
-from mlir_standalone.dialects import builtin as builtin_d, standalone as standalone_d
+from mlir_standalone import execution_engine, passmanager
+from mlir_standalone.dialects import (
+    builtin as builtin_d,
+    linalg as linalg_d,
+    sparse_tensor as sparse_tensor_d,
+    standalone as standalone_d,
+)
 
 with Context():
     standalone_d.register_dialect()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants